package cn.tedu._08security.service;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserDetailsServiceImpl implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        /**
         * 1.
         */
        return User.withUsername(username)
                .password("{noop}123456") //{noop} 表示不进行密码加密
                .authorities("sys:private:view","sys:private:edit")//从数据库查询
                .build();

    }
}
